package net.edu_soft.ec.asset.service.impl;

import net.edu_soft.ec.asset.mapper.FactoryMapper;
import net.edu_soft.ec.asset.pojo.Factory;
import net.edu_soft.ec.asset.pojo.FactoryExample;
import net.edu_soft.ec.asset.service.FactoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.List;

@Service
public class FactoryServiceImpl implements FactoryService {

    @Autowired
    private FactoryMapper factoryMapper;

    @Override
    public long countByExample(FactoryExample example) {
        return factoryMapper.countByExample(example);
    }

    @Override
    public int deleteByExample(FactoryExample example) {
        return 0;
    }

    @Override
    public int deleteByPrimaryKey(Integer factoryId) {
        return 0;
    }

    @Override
    public int insert(Factory record) {
        return factoryMapper.insert(record);
    }

    @Override
    public int insertSelective(Factory record) {
        return 0;
    }

    @Override
    public List<Factory> selectByExample(FactoryExample example) {

        return factoryMapper.selectByExample(example);
    }

    @Override
    public Factory selectByPrimaryKey(Integer factoryId) {
        Factory factory;
        try {
            factory=factoryMapper.selectByPrimaryKey(factoryId);
        }catch (NullPointerException e){
            return null;
        }
        return factory;
    }

    @Override
    public int updateByExampleSelective(Factory record, FactoryExample example) {
        return factoryMapper.updateByExampleSelective(record,example);
    }

    @Override
    public int updateByExample(Factory record, FactoryExample example) {
        return 0;
    }

    @Override
    public int updateByPrimaryKeySelective(Factory record) {
        return 0;
    }

    @Override
    public int updateByPrimaryKey(Factory record) {
        return 0;
    }
}
